package com.reform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.reform.pojo.phase.ViewEmpowerBatch;
import com.reform.mapper.ViewEmpowerBatchMapper;
import com.reform.res.Result;
import com.reform.res.ResultCode;
import com.reform.service.IViewEmpowerBatchService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * VIEW 服务实现类
 * </p>
 *
 * @author mortale
 * @since 2021-08-09
 */
@Service
public class ViewEmpowerBatchServiceImpl extends ServiceImpl<ViewEmpowerBatchMapper, ViewEmpowerBatch> implements IViewEmpowerBatchService {
    @Autowired
    ViewEmpowerBatchMapper viewEmpowerBatchMapper;

    @Override
    public Result getBatchByDepId(int depId) {
        QueryWrapper<ViewEmpowerBatch> viewEmpowerBatchQueryWrapper = new QueryWrapper<>();
        viewEmpowerBatchQueryWrapper.eq("dep_id", depId);
        viewEmpowerBatchQueryWrapper.orderByDesc("phase_teacher_end");
        return Result.success(ResultCode.SUCCESS, viewEmpowerBatchMapper.selectList(viewEmpowerBatchQueryWrapper));
    }
}
